﻿#region Regions

using System;
using System.Collections.Generic;

using FMWare.Core.Base;

#endregion

namespace FMWare.Core.Translations
{
	public class PlayerType : Item
	{
		#region Constructors

		public PlayerType()
		{
			Names = new List<String>();
			Names2 = new List<String>();
		}

		#endregion

		#region Public Properties

		public Byte Gender1 { get; set; }
		public Byte Gender2 { get; set; }
		public Byte Name2Count { get; set; }
		public Byte NameCount { get; set; }
		public List<String> Names { get; set; }
		public List<String> Names2 { get; set; }

		#endregion

		#region Internal Properties

		internal override string ExportData
		{
			get { return Global.CreateDelimitedString(UniqueId); }
		}

		#endregion

		#region Internal Methods

		internal override void Read(BinaryReader reader)
		{
			UniqueId = reader.ReadInt32();
			Gender1 = reader.ReadByte();
			NameCount = reader.ReadByte();
			for (int i = 0; i < NameCount; i++)
				Names.Add(reader.ReadString());
			Gender2 = reader.ReadByte();
			Name2Count = reader.ReadByte();
			for (int i = 0; i < Name2Count; i++)
				Names2.Add(reader.ReadString());
		}

		internal override void Write(BinaryWriter writer)
		{
			writer.Write(UniqueId);
			writer.Write(Gender1);
			writer.Write(NameCount);
			for (int i = 0; i < NameCount; i++)
				writer.Write(Names[i]);
			writer.Write(Gender2);
			writer.Write(Name2Count);
			for (int i = 0; i < Name2Count; i++)
				writer.Write(Names2[i]);
		}

		#endregion
	}
}